<template>
  <div>
    <h2>App组件</h2>
    <hr>
    <my-text v-for="item in goodsList" :key="item.id" :item="item" @kan="changeProperty"></my-text>
  </div>
</template>

<script>
import MyText from './components/MyText.vue'
  export default {
    data() {
      return {
        goodsList: [
        { id: 1, name: '方便面', price: 19.9, info:'纯天然, 无污染' },
        { id: 2, name: '火腿肠', price: 19.9, info:'纯天然, 无污染' },
        { id: 3, name: '鹌鹑蛋', price: 19.9, info:'纯天然, 无污染' }
        ]
       }
     },
  components: {
     MyText 
    },
    methods:{
      changeProperty(id) {
        console.log(id)
        let res = this.goodsList.find(item => item.id === id)
        res.price--
       }
     }
  }
</script>

<style lang="scss" scoped>

</style>